package mvc;

import frame.Component;
import org.apache.catalina.User;

@Component
@Controller
@RequestMapping("/hello")
public class HelloController {

    @RequestMapping("/world")
    public String hello() {
       return "Hello World";
    }

    @RequestMapping("/tomcat")
    public String tomcat(@Param("address") String address,@Param("port") Integer port) {
        return String.format("Server is running on %s:%d",address,port);
    }

    @RequestMapping("/local")
    public ModelAndView local() {
        ModelAndView mv = new ModelAndView();
        mv.setViewName("index.html");
        mv.getContext().put("address","localhost");
        mv.getContext().put("port","8080");
        return mv;
    }
}
